cmake_minimum_required(VERSION 3.15.7)
project(tests)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/)

find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})

find_package(Crow REQUIRED)
include_directories(${Crow_INCLUDE_DIRS})

find_package(cpr REQUIRED)
include_directories(${cpr_INCLUDE_DIRS})

find_package(OpenSSL REQUIRED)
include_directories(${OpenSSL_INCLUDE_DIRS})

find_package(SQLite3 REQUIRED)
include_directories(${SQLite3_INCLUDE_DIRS})

find_package(nlohmann_json REQUIRED)
include_directories(${nlohmann_json_INCLUDE_DIRS})

find_package(ICU REQUIRED)
include_directories(${ICU_INCLUDE_DIRS})

set(CMAKE_INCLUDE_CURRENT_DIR ON)

file(GLOB COMMON_API_SOURCES
    ${CMAKE_SOURCE_DIR}/src/common/api/server.cpp
    ${CMAKE_SOURCE_DIR}/src/common/api/client.cpp
)
file(GLOB COMMON_ELEMENTS_SOURCES
    ${CMAKE_SOURCE_DIR}/src/common/elements/*.cpp
)
file(GLOB COMMON_LOG_SOURCES
    ${CMAKE_SOURCE_DIR}/src/common/log/log.cpp
)
file(GLOB COMMON_CONFIG_SOURCES
    ${CMAKE_SOURCE_DIR}/src/common/config/config.cpp
)
file(GLOB COMMON_MORE_SOURCES
    ${CMAKE_SOURCE_DIR}/src/common/more/uuid.cpp
    ${CMAKE_SOURCE_DIR}/src/common/more/sha.cpp
    ${CMAKE_SOURCE_DIR}/src/common/more/json.cpp
    ${CMAKE_SOURCE_DIR}/src/common/more/string.cpp
)
file(GLOB COMMON_SOURCES
    ${COMMON_API_SOURCES}
    ${COMMON_ELEMENTS_SOURCES}
    ${COMMON_LOG_SOURCES}
    ${COMMON_CONFIG_SOURCES}
    ${COMMON_MORE_SOURCES}
)
file(GLOB DATENARO_SOURCES
    ${CMAKE_SOURCE_DIR}/src/datenaro/database/*.cpp
    ${CMAKE_SOURCE_DIR}/src/datenaro/database/migrations/*.cpp
    ${CMAKE_SOURCE_DIR}/src/datenaro/database/data_elements/*.cpp
)

add_subdirectory(elements)
add_subdirectory(api)
add_subdirectory(data_elements)
add_subdirectory(helpers)
